<div class="row">

	<div class="col-md-12">
          <h4>DADOS PARA PAGAMENTO</h4> 
          <a class="btn btn-danger btn-xs pull-right" href="<?php echo site_url('usuario/historico'); ?>">Voltar aos lances arrematados</a> 
	</div>
	<div class="col-md-1">
		<strong>NOME </strong>
	</div>
    <div class="col-md-11">
		<?php  echo $payments['0']->NOME;?>
	</div>   
  <br/><br/>

	<div class="col-md-12">

		<?php 
         if($this->session->flashdata('message_payment')){
         	echo $this->session->flashdata('message_payment');
         }   

		 $as_total = 0;
		 $this->table->set_template(array('table_open'=>'<table class="table table-bordered table-condensed grid-payments" >'));
		 $this->table->set_heading(array('#', 'Leilão','Nº Lote','Valor do Lance','Comissão','Taxa Admin'));
		 
    foreach ($payments as $key => $payment) {
    
    
		  $taxa =  get_taxa($payment->TOTAL);
		  $as_total +=   $payment->TOTAL;
		  
		  $total_comissao = ($payment->TOTAL * ($payment->comissao / 100));

		  $total_comissao_taxa = $total_comissao + $taxa + $payment->TOTAL;

          $as_total+=$total_comissao;

          $as_total +=  $taxa;

		 $this->table->add_row(
                   
              
		 	  array('data'=>form_hidden("codes[]",$payment->LOTE_ID).''.form_hidden("lotes[$key][total]",$total_comissao_taxa),'style'=>'width:30px;'),$payment->RAZAO,
		 	  array('data'=>$payment->num_lote . form_hidden("lotes[$key][name]",'Leilão Nº'.$payment->LEILAO_ID.' / Nº do Lote'.$payment->num_lote),'style'=>'width:60px;'),
		      array('data'=>number_format($payment->TOTAL,2,',','.') . form_hidden("lotes[$key][valor]",$total_comissao_taxa) 
                     . form_hidden("lotes[$key][comissao]",$total_comissao) 
                     . form_hidden("lotes[$key][lote_val]",$payment->TOTAL) 
                     . form_hidden("lotes[$key][taxa]",$taxa) 
		      	    ,
		      	    'style'=>'width:120px;'

		      	    ),
		      array('data'=>number_format($total_comissao,2,',','.'),'style'=>'width:80px;'),
		      array('data'=>number_format($taxa,2,',','.'),'style'=>'width:80px;')


		 	  );



             }
		 echo $this->table->generate();
		?>
</div>
<div class="col-md-3">
	  <div class="box-payments-options">
          <strong>Escolha a forma de pagamento</strong> <br/>
          <?php 
                       echo '<div class="form-group">'; 
              if($as_total <= 20000.00){
                  
              	  echo form_radio('payment_opition[]','cartao',false,'style="position:relative;top:1px;"');
              	  echo form_label('&nbsp;Cartão de crédito ');
              	 echo '<br>';
              }
             
              	  echo form_radio('payment_opition[]','boleto',false,'style="position:relative;top:1px;"');
              	  echo form_label('&nbsp;Boleto Bancário ');
              	  echo '</div>';
          ?>

          <div class="box-payment-container-options"></div>

	  </div>
</div>
   

</div>

<div class="box-total-data"  payment="total"  data-total-value="<?php echo $as_total;?>">
             <?php  echo 'Total R$ '.number_format($as_total,2,',','.');?>
</div>